﻿using System;

using Microsoft.VisualStudio.TestTools.UnitTesting;

using advadev.CanOpen;


namespace advadev.CanOpen.UnitTests
{

    /// <summary>
    /// Represents the service data object upload transfer unit tests
    /// </summary>
    [TestClass]
    public class ServiceDataObjectUploadTransferTest : ICanOpenObjectDictionaryContainer
    {

        #region constructor tests
        /// <summary>
        /// Constructor test
        /// </summary>
        [TestMethod]
        public void ConstructorTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x579;
            ICanOpenValueObject canOpenValueObject = new CanOpenUnsigned8(0xABCD, 0x0E, true, true) { Value = 0x7F };
            ServiceDataObjectUploadTransfer testObject = null;

            // can open value object null parameter
            try
            {
                testObject = new ServiceDataObjectUploadTransfer(null, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
                Assert.Fail();
            }
            catch (ArgumentNullException)
            {
            }
            catch
            {
                Assert.Fail();
            }

            // node id out of range parameter
            try
            {
                testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, 0, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
                Assert.Fail();
            }
            catch (ArgumentOutOfRangeException)
            {
            }
            catch
            {
                Assert.Fail();
            }
            try
            {
                testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, 128, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
                Assert.Fail();
            }
            catch (ArgumentOutOfRangeException)
            {
            }
            catch
            {
                Assert.Fail();
            }

            // block size out of range parameter
            try
            {
                testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, 0, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId, 0, 0);
                Assert.Fail();
            }
            catch (ArgumentOutOfRangeException)
            {
            }
            catch
            {
                Assert.Fail();
            }
            try
            {
                testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, 128, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId, 128, 0);
                Assert.Fail();
            }
            catch (ArgumentOutOfRangeException)
            {
            }
            catch
            {
                Assert.Fail();
            }
        }
        #endregion constructor tests


        #region client side Unsigned8 tests
        /// <summary>
        /// Client side Unsigned8 expedited transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideUnsigned8ExpeditedTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned8 canOpenValueObject = new CanOpenUnsigned8(0xABCD, 0x0E, true, true);
            ServiceDataObjectUploadTransfer testObject = null;

            // test with value 100
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x40, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ContinueAfterSendingMessages();
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x4F, 0xCD, 0xAB, 0x0E, 0x64, 0x00, 0x00, 0x00));
            Assert.AreEqual((ulong)100, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x4F, 0xCD, 0xAB, 0x0E, 0x64, 0x00, 0x00, 0x00));
            Assert.AreEqual((ulong)100, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x4F, 0x19, 0x82, 0x0E, 0x64, 0x00, 0x00, 0x00));
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Client side Unsigned8 segmented transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideUnsigned8SegmentedTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned8 canOpenValueObject = new CanOpenUnsigned8(0xABCD, 0x0E, true, true);
            ServiceDataObjectUploadTransfer testObject = null;

            // test with value 100
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x40, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ContinueAfterSendingMessages();
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0xCD, 0xAB, 0x0E, 0x01, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x60, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ContinueAfterSendingMessages();
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x0D, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((ulong)100, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x41, 0xCD, 0xAB, 0x0E, 0x01, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x0D, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((ulong)100, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0xCD, 0xAB, 0x0E, 0x01, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0x19, 0x82, 0x0E, 0x01, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x0D, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong toggle bit
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0xCD, 0xAB, 0x0E, 0x01, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x1D, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05030000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x80, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x03, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x05, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
        }

        /// <summary>
        /// Client side Unsigned8 block transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideUnsigned8BlockTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned8 canOpenValueObject = new CanOpenUnsigned8(0xABCD, 0x0E, true, true);
            ServiceDataObjectUploadTransfer testObject = null;

            // test with value 100
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA0, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(ServiceDataObjectUploadTransfer.DefaultBlockSize, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(ServiceDataObjectUploadTransfer.DefaultProtocolSwitchThreshold, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ContinueAfterSendingMessages();
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x01, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA3, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ContinueAfterSendingMessages();
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x81, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA2, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x01, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(ServiceDataObjectUploadTransfer.DefaultBlockSize, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ContinueAfterSendingMessages();
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xD9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((ulong)100, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA1, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);

            // test with changed COB-IDs
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xC2, 0xCD, 0xAB, 0x0E, 0x01, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x81, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xD9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((ulong)100, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);

            // test with received abort message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x01, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x81, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x01, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x81, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xF9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong acknowledged sequence number
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x01, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x82, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05040003", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with protocol switching
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x4F, 0xCD, 0xAB, 0x0E, 0x64, 0x00, 0x00, 0x00));
            Assert.AreEqual((ulong)100, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }
        #endregion client side Unsigned8 tests


        #region client side Integer8 tests
        /// <summary>
        /// Client side Integer8 expedited transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideInteger8ExpeditedTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger8 canOpenValueObject = new CanOpenInteger8(0xABCD, 0x0E, true, true);
            ServiceDataObjectUploadTransfer testObject = null;

            // test with value -100
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x40, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x4F, 0xCD, 0xAB, 0x0E, 0x9C, 0x00, 0x00, 0x00));
            Assert.AreEqual((long)-100, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x4F, 0xCD, 0xAB, 0x0E, 0x9C, 0x00, 0x00, 0x00));
            Assert.AreEqual((long)-100, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x4F, 0x19, 0x82, 0x0E, 0x9C, 0x00, 0x00, 0x00));
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Client side Integer8 segmented transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideInteger8SegmentedTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger8 canOpenValueObject = new CanOpenInteger8(0xABCD, 0x0E, true, true);
            ServiceDataObjectUploadTransfer testObject = null;

            // test with value -100
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x40, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0xCD, 0xAB, 0x0E, 0x01, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x60, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x0D, 0x9C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((long)-100, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x41, 0xCD, 0xAB, 0x0E, 0x01, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x0D, 0x9C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((long)-100, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0xCD, 0xAB, 0x0E, 0x01, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0x19, 0x82, 0x0E, 0x01, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x0D, 0x9C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong toggle bit
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0xCD, 0xAB, 0x0E, 0x01, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x1D, 0x9C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05030000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x80, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x03, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x05, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
        }

        /// <summary>
        /// Client side Integer8 block transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideInteger8BlockTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger8 canOpenValueObject = new CanOpenInteger8(0xABCD, 0x0E, true, true);
            ServiceDataObjectUploadTransfer testObject = null;

            // test with value -100
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA0, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(ServiceDataObjectUploadTransfer.DefaultBlockSize, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(ServiceDataObjectUploadTransfer.DefaultProtocolSwitchThreshold, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x01, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA3, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x81, 0x9C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA2, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x01, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(ServiceDataObjectUploadTransfer.DefaultBlockSize, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xD9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((long)-100, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA1, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);

            // test with changed COB-IDs
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xC2, 0xCD, 0xAB, 0x0E, 0x01, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x81, 0x9C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xD9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((long)-100, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);

            // test with received abort message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x01, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x81, 0x9C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x01, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x81, 0x9C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xF9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong acknowledged sequence number
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x01, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x82, 0x9C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05040003", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with protocol switching
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x4F, 0xCD, 0xAB, 0x0E, 0x9C, 0x00, 0x00, 0x00));
            Assert.AreEqual((long)-100, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }
        #endregion client side Integer8 tests


        #region client side Unsigned16 tests
        /// <summary>
        /// Client side Unsigned16 expedited transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideUnsigned16ExpeditedTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned16 canOpenValueObject = new CanOpenUnsigned16(0xABCD, 0x0E, true, true);
            ServiceDataObjectUploadTransfer testObject = null;

            // test with value 10000
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x40, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x4B, 0xCD, 0xAB, 0x0E, 0x10, 0x27, 0x00, 0x00));
            Assert.AreEqual((ulong)10000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x4B, 0xCD, 0xAB, 0x0E, 0x10, 0x27, 0x00, 0x00));
            Assert.AreEqual((ulong)10000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x4B, 0x19, 0x82, 0x0E, 0x10, 0x27, 0x00, 0x00));
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Client side Unsigned16 segmented transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideUnsigned16SegmentedTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned16 canOpenValueObject = new CanOpenUnsigned16(0xABCD, 0x0E, true, true);
            ServiceDataObjectUploadTransfer testObject = null;

            // test with value 10000
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x40, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0xCD, 0xAB, 0x0E, 0x02, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x60, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x0B, 0x10, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((ulong)10000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x41, 0xCD, 0xAB, 0x0E, 0x02, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x0B, 0x10, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((ulong)10000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0xCD, 0xAB, 0x0E, 0x02, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0x19, 0x82, 0x0E, 0x02, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x0B, 0x10, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong toggle bit
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0xCD, 0xAB, 0x0E, 0x02, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x1B, 0x10, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05030000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x80, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x03, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x05, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
        }

        /// <summary>
        /// Client side Unsigned16 block transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideUnsigned16BlockTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned16 canOpenValueObject = new CanOpenUnsigned16(0xABCD, 0x0E, true, true);
            ServiceDataObjectUploadTransfer testObject = null;

            // test with value 10000
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA0, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(ServiceDataObjectUploadTransfer.DefaultBlockSize, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(ServiceDataObjectUploadTransfer.DefaultProtocolSwitchThreshold, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x02, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA3, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x81, 0x27, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA2, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x01, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(ServiceDataObjectUploadTransfer.DefaultBlockSize, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xD5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((ulong)10000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA1, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);

            // test with changed COB-IDs
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xC2, 0xCD, 0xAB, 0x0E, 0x02, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x81, 0x27, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xD5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((ulong)10000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);

            // test with received abort message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x02, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x81, 0x27, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x02, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x81, 0x27, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xF5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong acknowledged sequence number
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x02, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x82, 0x27, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05040003", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with protocol switching
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x4B, 0xCD, 0xAB, 0x0E, 0x10, 0x27, 0x00, 0x00));
            Assert.AreEqual((ulong)10000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }
        #endregion client side Unsigned16 tests


        #region client side Integer16 tests
        /// <summary>
        /// Client side Integer16 expedited transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideInteger16ExpeditedTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger16 canOpenValueObject = new CanOpenInteger16(0xABCD, 0x0E, true, true);
            ServiceDataObjectUploadTransfer testObject = null;

            // test with value -10000
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x40, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x43, 0xCD, 0xAB, 0x0E, 0xF0, 0xD8, 0x00, 0x00));
            Assert.AreEqual((long)-10000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x43, 0xCD, 0xAB, 0x0E, 0xF0, 0xD8, 0x00, 0x00));
            Assert.AreEqual((long)-10000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x43, 0x19, 0x82, 0x0E, 0xF0, 0xD8, 0x00, 0x00));
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Client side Integer16 segmented transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideInteger16SegmentedTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger16 canOpenValueObject = new CanOpenInteger16(0xABCD, 0x0E, true, true);
            ServiceDataObjectUploadTransfer testObject = null;

            // test with value -10000
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x40, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0xCD, 0xAB, 0x0E, 0x02, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x60, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x0B, 0xF0, 0xD8, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((long)-10000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x41, 0xCD, 0xAB, 0x0E, 0x02, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x0B, 0xF0, 0xD8, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((long)-10000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0xCD, 0xAB, 0x0E, 0x02, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0x19, 0x82, 0x0E, 0x02, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x0B, 0xF0, 0xD8, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong toggle bit
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0xCD, 0xAB, 0x0E, 0x02, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x1B, 0xF0, 0xD8, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05030000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x80, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x03, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x05, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
        }

        /// <summary>
        /// Client side Integer16 block transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideInteger16BlockTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger16 canOpenValueObject = new CanOpenInteger16(0xABCD, 0x0E, true, true);
            ServiceDataObjectUploadTransfer testObject = null;

            // test with value -10000
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA0, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(ServiceDataObjectUploadTransfer.DefaultBlockSize, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(ServiceDataObjectUploadTransfer.DefaultProtocolSwitchThreshold, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x02, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA3, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x81, 0xD8, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA2, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x01, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(ServiceDataObjectUploadTransfer.DefaultBlockSize, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xD5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((long)-10000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA1, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);

            // test with changed COB-IDs
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xC2, 0xCD, 0xAB, 0x0E, 0x02, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x81, 0xD8, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xD5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((long)-10000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);

            // test with received abort message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x02, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x81, 0xD8, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x02, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x81, 0xD8, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xF5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong acknowledged sequence number
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x02, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x82, 0xD8, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05040003", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with protocol switching
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x43, 0xCD, 0xAB, 0x0E, 0xF0, 0xD8, 0x00, 0x00));
            Assert.AreEqual((long)-10000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }
        #endregion client side Integer16 tests


        #region client side Unsigned24 tests
        /// <summary>
        /// Client side Unsigned24 expedited transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideUnsigned24ExpeditedTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned24 canOpenValueObject = new CanOpenUnsigned24(0xABCD, 0x0E, true, true);
            ServiceDataObjectUploadTransfer testObject = null;

            // test with value 1000000
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x40, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x47, 0xCD, 0xAB, 0x0E, 0x40, 0x42, 0x0F, 0x00));
            Assert.AreEqual((ulong)1000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x47, 0xCD, 0xAB, 0x0E, 0x40, 0x42, 0x0F, 0x00));
            Assert.AreEqual((ulong)1000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x47, 0x19, 0x82, 0x0E, 0x40, 0x42, 0x0F, 0x00));
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Client side Unsigned24 segmented transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideUnsigned24SegmentedTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned24 canOpenValueObject = new CanOpenUnsigned24(0xABCD, 0x0E, true, true);
            ServiceDataObjectUploadTransfer testObject = null;

            // test with value 1000000
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x40, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0xCD, 0xAB, 0x0E, 0x03, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x60, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x09, 0x40, 0x42, 0x0F, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((ulong)1000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x41, 0xCD, 0xAB, 0x0E, 0x03, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x09, 0x40, 0x42, 0x0F, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((ulong)1000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0xCD, 0xAB, 0x0E, 0x03, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0x19, 0x82, 0x0E, 0x03, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x09, 0x40, 0x42, 0x0F, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong toggle bit
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0xCD, 0xAB, 0x0E, 0x03, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x19, 0x40, 0x42, 0x0F, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05030000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x80, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x03, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x05, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
        }

        /// <summary>
        /// Client side Unsigned24 block transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideUnsigned24BlockTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned24 canOpenValueObject = new CanOpenUnsigned24(0xABCD, 0x0E, true, true);
            ServiceDataObjectUploadTransfer testObject = null;

            // test with value 1000000
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA0, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(ServiceDataObjectUploadTransfer.DefaultBlockSize, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(ServiceDataObjectUploadTransfer.DefaultProtocolSwitchThreshold, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x03, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA3, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x81, 0x0F, 0x42, 0x40, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA2, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x01, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(ServiceDataObjectUploadTransfer.DefaultBlockSize, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xD1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((ulong)1000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA1, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);

            // test with changed COB-IDs
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xC2, 0xCD, 0xAB, 0x0E, 0x03, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x81, 0x0F, 0x42, 0x40, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xD1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((ulong)1000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);

            // test with received abort message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x03, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x81, 0x0F, 0x42, 0x40, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x03, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x81, 0x0F, 0x42, 0x40, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xF1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong acknowledged sequence number
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x03, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x82, 0x0F, 0x42, 0x40, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05040003", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with protocol switching
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x47, 0xCD, 0xAB, 0x0E, 0x40, 0x42, 0x0F, 0x00));
            Assert.AreEqual((ulong)1000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }
        #endregion client side Unsigned24 tests


        #region client side Integer24 tests
        /// <summary>
        /// Client side Integer24 expedited transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideInteger24ExpeditedTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger24 canOpenValueObject = new CanOpenInteger24(0xABCD, 0x0E, true, true);
            ServiceDataObjectUploadTransfer testObject = null;

            // test with value -1000000
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x40, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x47, 0xCD, 0xAB, 0x0E, 0xC0, 0xBD, 0xF0, 0x00));
            Assert.AreEqual((long)-1000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x47, 0xCD, 0xAB, 0x0E, 0xC0, 0xBD, 0xF0, 0x00));
            Assert.AreEqual((long)-1000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x47, 0x19, 0x82, 0x0E, 0xC0, 0xBD, 0xF0, 0x00));
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Client side Integer24 segmented transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideInteger24SegmentedTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger24 canOpenValueObject = new CanOpenInteger24(0xABCD, 0x0E, true, true);
            ServiceDataObjectUploadTransfer testObject = null;

            // test with value -1000000
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x40, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0xCD, 0xAB, 0x0E, 0x03, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x60, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x09, 0xC0, 0xBD, 0xF0, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((long)-1000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x41, 0xCD, 0xAB, 0x0E, 0x03, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x09, 0xC0, 0xBD, 0xF0, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((long)-1000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0xCD, 0xAB, 0x0E, 0x03, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0x19, 0x82, 0x0E, 0x03, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x09, 0xC0, 0xBD, 0xF0, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong toggle bit
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0xCD, 0xAB, 0x0E, 0x03, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x19, 0xC0, 0xBD, 0xF0, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05030000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x80, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x03, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x05, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
        }

        /// <summary>
        /// Client side Integer24 block transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideInteger24BlockTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger24 canOpenValueObject = new CanOpenInteger24(0xABCD, 0x0E, true, true);
            ServiceDataObjectUploadTransfer testObject = null;

            // test with value -1000000
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA0, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(ServiceDataObjectUploadTransfer.DefaultBlockSize, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(ServiceDataObjectUploadTransfer.DefaultProtocolSwitchThreshold, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x03, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA3, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x81, 0xF0, 0xBD, 0xC0, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA2, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x01, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(ServiceDataObjectUploadTransfer.DefaultBlockSize, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xD1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((long)-1000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA1, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);

            // test with changed COB-IDs
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xC2, 0xCD, 0xAB, 0x0E, 0x03, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x81, 0xF0, 0xBD, 0xC0, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xD1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((long)-1000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);

            // test with received abort message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x03, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x81, 0xF0, 0xBD, 0xC0, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x03, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x81, 0xF0, 0xBD, 0xC0, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xF1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong acknowledged sequence number
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x03, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x82, 0xF0, 0xBD, 0xC0, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05040003", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with protocol switching
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x47, 0xCD, 0xAB, 0x0E, 0xC0, 0xBD, 0xF0, 0x00));
            Assert.AreEqual((long)-1000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }
        #endregion client side Integer24 tests


        #region client side Unsigned32 tests
        /// <summary>
        /// Client side Unsigned32 expedited transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideUnsigned32ExpeditedTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned32 canOpenValueObject = new CanOpenUnsigned32(0xABCD, 0x0E, true, true);
            ServiceDataObjectUploadTransfer testObject = null;

            // test with value 1000000000
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x40, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x43, 0xCD, 0xAB, 0x0E, 0x00, 0xCA, 0x9A, 0x3B));
            Assert.AreEqual((ulong)1000000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x43, 0xCD, 0xAB, 0x0E, 0x00, 0xCA, 0x9A, 0x3B));
            Assert.AreEqual((ulong)1000000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x43, 0x19, 0x82, 0x0E, 0x00, 0xCA, 0x9A, 0x3B));
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Client side Unsigned32 segmented transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideUnsigned32SegmentedTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned32 canOpenValueObject = new CanOpenUnsigned32(0xABCD, 0x0E, true, true);
            ServiceDataObjectUploadTransfer testObject = null;

            // test with value 1000000000
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x40, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0xCD, 0xAB, 0x0E, 0x04, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x60, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x07, 0x00, 0xCA, 0x9A, 0x3B, 0x00, 0x00, 0x00));
            Assert.AreEqual((ulong)1000000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x41, 0xCD, 0xAB, 0x0E, 0x04, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x07, 0x00, 0xCA, 0x9A, 0x3B, 0x00, 0x00, 0x00));
            Assert.AreEqual((ulong)1000000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0xCD, 0xAB, 0x0E, 0x04, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0x19, 0x82, 0x0E, 0x04, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x07, 0x00, 0xCA, 0x9A, 0x3B, 0x00, 0x00, 0x00));
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong toggle bit
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0xCD, 0xAB, 0x0E, 0x04, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x17, 0x00, 0xCA, 0x9A, 0x3B, 0x00, 0x00, 0x00));
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05030000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x80, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x03, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x05, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
        }

        /// <summary>
        /// Client side Unsigned32 block transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideUnsigned32BlockTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned32 canOpenValueObject = new CanOpenUnsigned32(0xABCD, 0x0E, true, true);
            ServiceDataObjectUploadTransfer testObject = null;

            // test with value 1000000000
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA0, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(ServiceDataObjectUploadTransfer.DefaultBlockSize, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(ServiceDataObjectUploadTransfer.DefaultProtocolSwitchThreshold, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x04, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA3, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x81, 0x3B, 0x9A, 0xCA, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA2, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x01, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(ServiceDataObjectUploadTransfer.DefaultBlockSize, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xCD, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((ulong)1000000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA1, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);

            // test with changed COB-IDs
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xC2, 0xCD, 0xAB, 0x0E, 0x04, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x81, 0x3B, 0x9A, 0xCA, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xCD, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((ulong)1000000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);

            // test with received abort message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x04, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x81, 0x3B, 0x9A, 0xCA, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x04, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x81, 0x3B, 0x9A, 0xCA, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xED, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong acknowledged sequence number
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x04, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x82, 0x3B, 0x9A, 0xCA, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05040003", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with protocol switching
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x43, 0xCD, 0xAB, 0x0E, 0x00, 0xCA, 0x9A, 0x3B));
            Assert.AreEqual((ulong)1000000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }
        #endregion client side Unsigned32 tests


        #region client side Integer32 tests
        /// <summary>
        /// Client side Integer32 expedited transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideInteger32ExpeditedTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger32 canOpenValueObject = new CanOpenInteger32(0xABCD, 0x0E, true, true);
            ServiceDataObjectUploadTransfer testObject = null;

            // test with value -1000000000
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x40, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x43, 0xCD, 0xAB, 0x0E, 0x00, 0x36, 0x65, 0xC4));
            Assert.AreEqual((long)-1000000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x43, 0xCD, 0xAB, 0x0E, 0x00, 0x36, 0x65, 0xC4));
            Assert.AreEqual((long)-1000000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x43, 0x19, 0x82, 0x0E, 0x00, 0x36, 0x65, 0xC4));
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Client side Integer32 segmented transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideInteger32SegmentedTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger32 canOpenValueObject = new CanOpenInteger32(0xABCD, 0x0E, true, true);
            ServiceDataObjectUploadTransfer testObject = null;

            // test with value -1000000000
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x40, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0xCD, 0xAB, 0x0E, 0x04, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x60, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x07, 0x00, 0x36, 0x65, 0xC4, 0x00, 0x00, 0x00));
            Assert.AreEqual((long)-1000000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x41, 0xCD, 0xAB, 0x0E, 0x04, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x07, 0x00, 0x36, 0x65, 0xC4, 0x00, 0x00, 0x00));
            Assert.AreEqual((long)-1000000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0xCD, 0xAB, 0x0E, 0x04, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0x19, 0x82, 0x0E, 0x04, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x07, 0x00, 0x36, 0x65, 0xC4, 0x00, 0x00, 0x00));
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong toggle bit
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0xCD, 0xAB, 0x0E, 0x04, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x17, 0x00, 0x36, 0x65, 0xC4, 0x00, 0x00, 0x00));
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05030000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x80, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x03, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x05, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
        }

        /// <summary>
        /// Client side Integer32 block transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideInteger32BlockTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger32 canOpenValueObject = new CanOpenInteger32(0xABCD, 0x0E, true, true);
            ServiceDataObjectUploadTransfer testObject = null;

            // test with value -1000000000
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA0, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(ServiceDataObjectUploadTransfer.DefaultBlockSize, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(ServiceDataObjectUploadTransfer.DefaultProtocolSwitchThreshold, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x04, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA3, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x81, 0xC4, 0x65, 0x36, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA2, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x01, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(ServiceDataObjectUploadTransfer.DefaultBlockSize, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xCD, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((long)-1000000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA1, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);

            // test with changed COB-IDs
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xC2, 0xCD, 0xAB, 0x0E, 0x04, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x81, 0xC4, 0x65, 0x36, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xCD, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((long)-1000000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);

            // test with received abort message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x04, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x81, 0xC4, 0x65, 0x36, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x04, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x81, 0xC4, 0x65, 0x36, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xED, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong acknowledged sequence number
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x04, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x82, 0xC4, 0x65, 0x36, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05040003", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with protocol switching
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x43, 0xCD, 0xAB, 0x0E, 0x00, 0x36, 0x65, 0xC4));
            Assert.AreEqual((long)-1000000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }
        #endregion client side Integer32 tests


        #region client side Unsigned40 tests
        /// <summary>
        /// Client side Unsigned40 segmented transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideUnsigned40SegmentedTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned40 canOpenValueObject = new CanOpenUnsigned40(0xABCD, 0x0E, true, true);
            ServiceDataObjectUploadTransfer testObject = null;

            // test with value 100000000000
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x40, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0xCD, 0xAB, 0x0E, 0x05, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x60, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x05, 0x00, 0xE8, 0x76, 0x48, 0x17, 0x00, 0x00));
            Assert.AreEqual((ulong)100000000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x41, 0xCD, 0xAB, 0x0E, 0x05, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x05, 0x00, 0xE8, 0x76, 0x48, 0x17, 0x00, 0x00));
            Assert.AreEqual((ulong)100000000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0xCD, 0xAB, 0x0E, 0x05, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0x19, 0x82, 0x0E, 0x05, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x05, 0x00, 0xE8, 0x76, 0x48, 0x17, 0x00, 0x00));
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong toggle bit
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0xCD, 0xAB, 0x0E, 0x05, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x15, 0x00, 0xE8, 0x76, 0x48, 0x17, 0x00, 0x00));
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05030000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x80, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x03, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x05, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
        }

        /// <summary>
        /// Client side Unsigned40 block transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideUnsigned40BlockTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned40 canOpenValueObject = new CanOpenUnsigned40(0xABCD, 0x0E, true, true);
            ServiceDataObjectUploadTransfer testObject = null;

            // test with value 100000000000
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA0, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(ServiceDataObjectUploadTransfer.DefaultBlockSize, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(ServiceDataObjectUploadTransfer.DefaultProtocolSwitchThreshold, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x05, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA3, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x81, 0x17, 0x48, 0x76, 0xE8, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA2, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x01, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(ServiceDataObjectUploadTransfer.DefaultBlockSize, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((ulong)100000000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA1, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);

            // test with changed COB-IDs
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xC2, 0xCD, 0xAB, 0x0E, 0x05, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x81, 0x17, 0x48, 0x76, 0xE8, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xC9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((ulong)100000000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);

            // test with received abort message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x05, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x81, 0x17, 0x48, 0x76, 0xE8, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x05, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x81, 0x17, 0x48, 0x76, 0xE8, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xE9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong acknowledged sequence number
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x05, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x82, 0x17, 0x48, 0x76, 0xE8, 0x00, 0x00, 0x00));
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05040003", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with protocol switching
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0xCD, 0xAB, 0x0E, 0x05, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x05, 0x00, 0xE8, 0x76, 0x48, 0x17, 0x00, 0x00));
            Assert.AreEqual((ulong)100000000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }
        #endregion client side Unsigned40 tests


        #region client side Integer40 tests
        /// <summary>
        /// Client side Integer40 segmented transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideInteger40SegmentedTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger40 canOpenValueObject = new CanOpenInteger40(0xABCD, 0x0E, true, true);
            ServiceDataObjectUploadTransfer testObject = null;

            // test with value -100000000000
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x40, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0xCD, 0xAB, 0x0E, 0x05, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x60, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x05, 0x00, 0x18, 0x89, 0xB7, 0xE8, 0x00, 0x00));
            Assert.AreEqual((long)-100000000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x41, 0xCD, 0xAB, 0x0E, 0x05, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x05, 0x00, 0x18, 0x89, 0xB7, 0xE8, 0x00, 0x00));
            Assert.AreEqual((long)-100000000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0xCD, 0xAB, 0x0E, 0x05, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0x19, 0x82, 0x0E, 0x05, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x05, 0x00, 0x18, 0x89, 0xB7, 0xE8, 0x00, 0x00));
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong toggle bit
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0xCD, 0xAB, 0x0E, 0x05, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x15, 0x00, 0x18, 0x89, 0xB7, 0xE8, 0x00, 0x00));
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05030000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x80, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x03, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x05, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
        }

        /// <summary>
        /// Client side Integer40 block transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideInteger40BlockTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger40 canOpenValueObject = new CanOpenInteger40(0xABCD, 0x0E, true, true);
            ServiceDataObjectUploadTransfer testObject = null;

            // test with value -100000000000
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA0, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(ServiceDataObjectUploadTransfer.DefaultBlockSize, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(ServiceDataObjectUploadTransfer.DefaultProtocolSwitchThreshold, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x05, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA3, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x81, 0xE8, 0xB7, 0x89, 0x18, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA2, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x01, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(ServiceDataObjectUploadTransfer.DefaultBlockSize, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((long)-100000000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA1, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);

            // test with changed COB-IDs
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xC2, 0xCD, 0xAB, 0x0E, 0x05, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x81, 0xE8, 0xB7, 0x89, 0x18, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xC9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((long)-100000000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);

            // test with received abort message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x05, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x81, 0xE8, 0xB7, 0x89, 0x18, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x05, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x81, 0xE8, 0xB7, 0x89, 0x18, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xE9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong acknowledged sequence number
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x05, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x82, 0xE8, 0xB7, 0x89, 0x18, 0x00, 0x00, 0x00));
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05040003", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with protocol switching
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0xCD, 0xAB, 0x0E, 0x05, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x05, 0x00, 0x18, 0x89, 0xB7, 0xE8, 0x00, 0x00));
            Assert.AreEqual((long)-100000000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }
        #endregion client side Integer40 tests


        #region client side Unsigned48 tests
        /// <summary>
        /// Client side Unsigned48 segmented transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideUnsigned48SegmentedTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned48 canOpenValueObject = new CanOpenUnsigned48(0xABCD, 0x0E, true, true);
            ServiceDataObjectUploadTransfer testObject = null;

            // test with value 100000000000000
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x40, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0xCD, 0xAB, 0x0E, 0x06, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x60, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x03, 0x00, 0x40, 0x7A, 0x10, 0xF3, 0x5A, 0x00));
            Assert.AreEqual((ulong)100000000000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x41, 0xCD, 0xAB, 0x0E, 0x06, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x03, 0x00, 0x40, 0x7A, 0x10, 0xF3, 0x5A, 0x00));
            Assert.AreEqual((ulong)100000000000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0xCD, 0xAB, 0x0E, 0x06, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0x19, 0x82, 0x0E, 0x06, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x03, 0x00, 0x40, 0x7A, 0x10, 0xF3, 0x5A, 0x00));
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong toggle bit
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0xCD, 0xAB, 0x0E, 0x06, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x13, 0x00, 0x40, 0x7A, 0x10, 0xF3, 0x5A, 0x00));
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05030000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x80, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x03, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x05, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
        }

        /// <summary>
        /// Client side Unsigned48 block transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideUnsigned48BlockTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned48 canOpenValueObject = new CanOpenUnsigned48(0xABCD, 0x0E, true, true);
            ServiceDataObjectUploadTransfer testObject = null;

            // test with value 100000000000000
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA0, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(ServiceDataObjectUploadTransfer.DefaultBlockSize, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(ServiceDataObjectUploadTransfer.DefaultProtocolSwitchThreshold, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x06, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA3, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x81, 0x5A, 0xF3, 0x10, 0x7A, 0x40, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA2, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x01, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(ServiceDataObjectUploadTransfer.DefaultBlockSize, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((ulong)100000000000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA1, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);

            // test with changed COB-IDs
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xC2, 0xCD, 0xAB, 0x0E, 0x06, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x81, 0x5A, 0xF3, 0x10, 0x7A, 0x40, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xC5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((ulong)100000000000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);

            // test with received abort message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x06, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x81, 0x5A, 0xF3, 0x10, 0x7A, 0x40, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x06, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x81, 0x5A, 0xF3, 0x10, 0x7A, 0x40, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xE5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong acknowledged sequence number
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x06, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x82, 0x5A, 0xF3, 0x10, 0x7A, 0x40, 0x00, 0x00));
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05040003", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with protocol switching
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0xCD, 0xAB, 0x0E, 0x06, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x03, 0x00, 0x40, 0x7A, 0x10, 0xF3, 0x5A, 0x00));
            Assert.AreEqual((ulong)100000000000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }
        #endregion client side Unsigned48 tests


        #region client side Integer48 tests
        /// <summary>
        /// Client side Integer48 segmented transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideInteger48SegmentedTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger48 canOpenValueObject = new CanOpenInteger48(0xABCD, 0x0E, true, true);
            ServiceDataObjectUploadTransfer testObject = null;

            // test with value -100000000000000
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x40, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0xCD, 0xAB, 0x0E, 0x06, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x60, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x03, 0x00, 0xC0, 0x85, 0xEF, 0x0C, 0xA5, 0x00));
            Assert.AreEqual((long)-100000000000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x41, 0xCD, 0xAB, 0x0E, 0x06, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x03, 0x00, 0xC0, 0x85, 0xEF, 0x0C, 0xA5, 0x00));
            Assert.AreEqual((long)-100000000000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0xCD, 0xAB, 0x0E, 0x06, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0x19, 0x82, 0x0E, 0x06, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x03, 0x00, 0xC0, 0x85, 0xEF, 0x0C, 0xA5, 0x00));
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong toggle bit
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0xCD, 0xAB, 0x0E, 0x06, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x13, 0x00, 0xC0, 0x85, 0xEF, 0x0C, 0xA5, 0x00));
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05030000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x80, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x03, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x05, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
        }

        /// <summary>
        /// Client side Integer48 block transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideInteger48BlockTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger48 canOpenValueObject = new CanOpenInteger48(0xABCD, 0x0E, true, true);
            ServiceDataObjectUploadTransfer testObject = null;

            // test with value -100000000000000
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA0, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(ServiceDataObjectUploadTransfer.DefaultBlockSize, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(ServiceDataObjectUploadTransfer.DefaultProtocolSwitchThreshold, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x06, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA3, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x81, 0xA5, 0x0C, 0xEF, 0x85, 0xC0, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA2, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x01, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(ServiceDataObjectUploadTransfer.DefaultBlockSize, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((long)-100000000000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA1, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);

            // test with changed COB-IDs
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xC2, 0xCD, 0xAB, 0x0E, 0x06, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x81, 0xA5, 0x0C, 0xEF, 0x85, 0xC0, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xC5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((long)-100000000000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);

            // test with received abort message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x06, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x81, 0xA5, 0x0C, 0xEF, 0x85, 0xC0, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x06, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x81, 0xA5, 0x0C, 0xEF, 0x85, 0xC0, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xE5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong acknowledged sequence number
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x06, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x82, 0xA5, 0x0C, 0xEF, 0x85, 0xC0, 0x00, 0x00));
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05040003", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with protocol switching
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0xCD, 0xAB, 0x0E, 0x06, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x03, 0x00, 0xC0, 0x85, 0xEF, 0x0C, 0xA5, 0x00));
            Assert.AreEqual((long)-100000000000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }
        #endregion client side Integer48 tests


        #region client side Unsigned56 tests
        /// <summary>
        /// Client side Unsigned56 segmented transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideUnsigned56SegmentedTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned56 canOpenValueObject = new CanOpenUnsigned56(0xABCD, 0x0E, true, true);
            ServiceDataObjectUploadTransfer testObject = null;

            // test with value 10000000000000000
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x40, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0xCD, 0xAB, 0x0E, 0x07, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x60, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x01, 0x00, 0x00, 0xC1, 0x6F, 0xF2, 0x86, 0x23));
            Assert.AreEqual((ulong)10000000000000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x41, 0xCD, 0xAB, 0x0E, 0x07, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x01, 0x00, 0x00, 0xC1, 0x6F, 0xF2, 0x86, 0x23));
            Assert.AreEqual((ulong)10000000000000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0xCD, 0xAB, 0x0E, 0x07, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0x19, 0x82, 0x0E, 0x07, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x01, 0x00, 0x00, 0xC1, 0x6F, 0xF2, 0x86, 0x23));
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong toggle bit
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0xCD, 0xAB, 0x0E, 0x07, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x11, 0x00, 0x00, 0xC1, 0x6F, 0xF2, 0x86, 0x23));
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05030000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x80, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x03, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x05, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
        }

        /// <summary>
        /// Client side Unsigned56 block transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideUnsigned56BlockTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned56 canOpenValueObject = new CanOpenUnsigned56(0xABCD, 0x0E, true, true);
            ServiceDataObjectUploadTransfer testObject = null;

            // test with value 10000000000000000
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA0, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(ServiceDataObjectUploadTransfer.DefaultBlockSize, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(ServiceDataObjectUploadTransfer.DefaultProtocolSwitchThreshold, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x07, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA3, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x81, 0x23, 0x86, 0xF2, 0x6F, 0xC1, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA2, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x01, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(ServiceDataObjectUploadTransfer.DefaultBlockSize, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((ulong)10000000000000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA1, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);

            // test with changed COB-IDs
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xC2, 0xCD, 0xAB, 0x0E, 0x07, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x81, 0x23, 0x86, 0xF2, 0x6F, 0xC1, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xC1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((ulong)10000000000000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);

            // test with received abort message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x07, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x81, 0x23, 0x86, 0xF2, 0x6F, 0xC1, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x07, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x81, 0x23, 0x86, 0xF2, 0x6F, 0xC1, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xE1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong acknowledged sequence number
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x07, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x82, 0x23, 0x86, 0xF2, 0x6F, 0xC1, 0x00, 0x00));
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05040003", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with protocol switching
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0xCD, 0xAB, 0x0E, 0x07, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x01, 0x00, 0x00, 0xC1, 0x6F, 0xF2, 0x86, 0x23));
            Assert.AreEqual((ulong)10000000000000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }
        #endregion client side Unsigned56 tests


        #region client side Integer56 tests
        /// <summary>
        /// Client side Integer56 segmented transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideInteger56SegmentedTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger56 canOpenValueObject = new CanOpenInteger56(0xABCD, 0x0E, true, true);
            ServiceDataObjectUploadTransfer testObject = null;

            // test with value -10000000000000000
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x40, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0xCD, 0xAB, 0x0E, 0x07, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x60, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x01, 0x00, 0x00, 0x3F, 0x90, 0x0D, 0x79, 0xDC));
            Assert.AreEqual((long)-10000000000000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x41, 0xCD, 0xAB, 0x0E, 0x07, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x01, 0x00, 0x00, 0x3F, 0x90, 0x0D, 0x79, 0xDC));
            Assert.AreEqual((long)-10000000000000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0xCD, 0xAB, 0x0E, 0x07, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0x19, 0x82, 0x0E, 0x07, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x01, 0x00, 0x00, 0x3F, 0x90, 0x0D, 0x79, 0xDC));
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong toggle bit
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0xCD, 0xAB, 0x0E, 0x07, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x11, 0x00, 0x00, 0x3F, 0x90, 0x0D, 0x79, 0xDC));
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05030000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x80, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x03, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x05, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
        }

        /// <summary>
        /// Client side Integer56 block transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideInteger56BlockTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger56 canOpenValueObject = new CanOpenInteger56(0xABCD, 0x0E, true, true);
            ServiceDataObjectUploadTransfer testObject = null;

            // test with value -10000000000000000
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA0, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(ServiceDataObjectUploadTransfer.DefaultBlockSize, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(ServiceDataObjectUploadTransfer.DefaultProtocolSwitchThreshold, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x07, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA3, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x81, 0xDC, 0x79, 0x0D, 0x90, 0x3F, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA2, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x01, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(ServiceDataObjectUploadTransfer.DefaultBlockSize, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((long)-10000000000000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA1, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);

            // test with changed COB-IDs
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xC2, 0xCD, 0xAB, 0x0E, 0x07, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x81, 0xDC, 0x79, 0x0D, 0x90, 0x3F, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xC1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((long)-10000000000000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);

            // test with received abort message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x07, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x81, 0xDC, 0x79, 0x0D, 0x90, 0x3F, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x07, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x81, 0xDC, 0x79, 0x0D, 0x90, 0x3F, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xE1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong acknowledged sequence number
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x07, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x82, 0xDC, 0x79, 0x0D, 0x90, 0x3F, 0x00, 0x00));
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05040003", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with protocol switching
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0xCD, 0xAB, 0x0E, 0x07, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x01, 0x00, 0x00, 0x3F, 0x90, 0x0D, 0x79, 0xDC));
            Assert.AreEqual((long)-10000000000000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }
        #endregion client side Integer56 tests


        #region client side Unsigned64 tests
        /// <summary>
        /// Client side Unsigned64 segmented transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideUnsigned64SegmentedTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned64 canOpenValueObject = new CanOpenUnsigned64(0xABCD, 0x0E, true, true);
            ServiceDataObjectUploadTransfer testObject = null;

            // test with value 1000000000000000000
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x40, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0xCD, 0xAB, 0x0E, 0x08, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x60, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x00, 0x00, 0x00, 0x64, 0xA7, 0xB3, 0xB6, 0xE0));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x70, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x1D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((ulong)1000000000000000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x41, 0xCD, 0xAB, 0x0E, 0x08, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x00, 0x00, 0x00, 0x64, 0xA7, 0xB3, 0xB6, 0xE0));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x1D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((ulong)1000000000000000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0xCD, 0xAB, 0x0E, 0x08, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0x19, 0x82, 0x0E, 0x08, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x00, 0x00, 0x00, 0x64, 0xA7, 0xB3, 0xB6, 0xE0));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x1D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong toggle bit
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0xCD, 0xAB, 0x0E, 0x08, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x10, 0x00, 0x00, 0x64, 0xA7, 0xB3, 0xB6, 0xE0));
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05030000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x80, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x03, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x05, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
        }

        /// <summary>
        /// Client side Unsigned64 block transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideUnsigned64BlockTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned64 canOpenValueObject = new CanOpenUnsigned64(0xABCD, 0x0E, true, true);
            ServiceDataObjectUploadTransfer testObject = null;

            // test with value 1000000000000000000
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA0, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(ServiceDataObjectUploadTransfer.DefaultBlockSize, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(ServiceDataObjectUploadTransfer.DefaultProtocolSwitchThreshold, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x08, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA3, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x01, 0x0D, 0xE0, 0xB6, 0xB3, 0xA7, 0x64, 0x00));
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA2, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x02, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(ServiceDataObjectUploadTransfer.DefaultBlockSize, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xD9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((ulong)1000000000000000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA1, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);

            // test with changed COB-IDs
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xC2, 0xCD, 0xAB, 0x0E, 0x08, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x01, 0x0D, 0xE0, 0xB6, 0xB3, 0xA7, 0x64, 0x00));
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xD9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((ulong)1000000000000000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);

            // test with received abort message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x08, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x01, 0x0D, 0xE0, 0xB6, 0xB3, 0xA7, 0x64, 0x00));
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x08, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x01, 0x0D, 0xE0, 0xB6, 0xB3, 0xA7, 0x64, 0x00));
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xF9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong acknowledged sequence number
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x08, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x02, 0x0D, 0xE0, 0xB6, 0xB3, 0xA7, 0x64, 0x00));
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05040003", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with protocol switching
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0xCD, 0xAB, 0x0E, 0x08, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x00, 0x00, 0x00, 0x64, 0xA7, 0xB3, 0xB6, 0xE0));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x1D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((ulong)1000000000000000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }
        #endregion client side Unsigned64 tests


        #region client side Integer64 tests
        /// <summary>
        /// Client side Integer64 segmented transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideInteger64SegmentedTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger64 canOpenValueObject = new CanOpenInteger64(0xABCD, 0x0E, true, true);
            ServiceDataObjectUploadTransfer testObject = null;

            // test with value -1000000000000000000
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x40, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0xCD, 0xAB, 0x0E, 0x08, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x60, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x00, 0x00, 0x00, 0x9C, 0x58, 0x4C, 0x49, 0x1F));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x70, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x1D, 0xF2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((long)-1000000000000000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with changed COB-IDs
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x41, 0xCD, 0xAB, 0x0E, 0x08, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x00, 0x00, 0x00, 0x9C, 0x58, 0x4C, 0x49, 0x1F));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x1D, 0xF2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((long)-1000000000000000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with received abort message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0xCD, 0xAB, 0x0E, 0x08, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0x19, 0x82, 0x0E, 0x08, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x00, 0x00, 0x00, 0x9C, 0x58, 0x4C, 0x49, 0x1F));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x1D, 0xF2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong toggle bit
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0xCD, 0xAB, 0x0E, 0x08, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x10, 0x00, 0x00, 0x9C, 0x58, 0x4C, 0x49, 0x1F));
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05030000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0x80, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x03, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x05, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
        }

        /// <summary>
        /// Client side Integer64 block transfer test
        /// </summary>
        [TestMethod]
        public void ClientSideInteger64BlockTransferTest()
        {
            // initialization
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger64 canOpenValueObject = new CanOpenInteger64(0xABCD, 0x0E, true, true);
            ServiceDataObjectUploadTransfer testObject = null;

            // test with value -1000000000000000000
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA0, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0xCD, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0xAB, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x0E, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(ServiceDataObjectUploadTransfer.DefaultBlockSize, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(ServiceDataObjectUploadTransfer.DefaultProtocolSwitchThreshold, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x08, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA3, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x01, 0xF2, 0x1F, 0x49, 0x4C, 0x58, 0x9C, 0x00));
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA2, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x02, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(ServiceDataObjectUploadTransfer.DefaultBlockSize, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xD9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((long)-1000000000000000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(0x667, testObject.PendingSendMessages[0].CanId);
            Assert.AreEqual(0xA1, testObject.PendingSendMessages[0].Byte0);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte1);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte2);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte3);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte4);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte5);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte6);
            Assert.AreEqual(0x00, testObject.PendingSendMessages[0].Byte7);
            Assert.AreEqual((uint)8, testObject.PendingSendMessages[0].Length);

            // test with changed COB-IDs
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xC2, 0xCD, 0xAB, 0x0E, 0x08, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x01, 0xF2, 0x1F, 0x49, 0x4C, 0x58, 0x9C, 0x00));
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);
            testObject.ProcessReceivedMessage(new CanOpenMessage((UInt16)(receiveCobId + nodeId), 0xD9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((long)-1000000000000000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            Assert.AreEqual(sendCobId + nodeId, testObject.PendingSendMessages[0].CanId);

            // test with received abort message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x08, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x01, 0xF2, 0x1F, 0x49, 0x4C, 0x58, 0x9C, 0x00));
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x80, 0xCD, 0xAB, 0x0E, 0xD4, 0xC3, 0xB2, 0xA1));
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0xA1B2C3D4", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);

            // test with not matching received message
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x08, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x01, 0xF2, 0x1F, 0x49, 0x4C, 0x58, 0x9C, 0x00));
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xE9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with wrong acknowledged sequence number
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0xC2, 0xCD, 0xAB, 0x0E, 0x08, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x02, 0xF2, 0x1F, 0x49, 0x4C, 0x58, 0x9C, 0x00));
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x05040003", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with protocol switching
            canOpenValueObject.Value = 0;
            testObject = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x41, 0xCD, 0xAB, 0x0E, 0x08, 0x00, 0x00, 0x00));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x00, 0x00, 0x00, 0x9C, 0x58, 0x4C, 0x49, 0x1F));
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            testObject.ProcessReceivedMessage(new CanOpenMessage(0x5E7, 0x1D, 0xF2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
            Assert.AreEqual((long)-1000000000000000000, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
        }
        #endregion client side Integer64 tests


        #region is service data object download transfer request tests
        /// <summary>
        /// Is service data object upload transfer request test
        /// </summary>
        [TestMethod]
        public void IsServiceDataObjectUploadTransferRequestTest()
        {
            // initialization
            bool isServiceDataObjectUploadTransferRequest = false;
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned8 canOpenValueObject = new CanOpenUnsigned8(0x0008, 0x00, true, true);
            ServiceDataObjectUploadTransfer testObject = null;

            // test with valid received can open message
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(new CanOpenMessage(0x667, 0x40, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00), this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);

            // test with not valid received can open message
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(new CanOpenMessage(0x667, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00), this, out testObject);
            Assert.AreEqual(false, isServiceDataObjectUploadTransferRequest);
            Assert.IsNull(testObject);

            // test with can open object dictionary is null
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(new CanOpenMessage(0x667, 0x40, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00), null, out testObject);
            Assert.AreEqual(false, isServiceDataObjectUploadTransferRequest);
            Assert.IsNull(testObject);

            // test with invalid node id
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(new CanOpenMessage(0x600, 0x40, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00), this, out testObject);
            Assert.AreEqual(false, isServiceDataObjectUploadTransferRequest);
            Assert.IsNull(testObject);
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(new CanOpenMessage(0x680, 0x40, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00), this, out testObject);
            Assert.AreEqual(false, isServiceDataObjectUploadTransferRequest);
            Assert.IsNull(testObject);

            // test with received can open message is null
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(null, this, out testObject);
            Assert.AreEqual(false, isServiceDataObjectUploadTransferRequest);
            Assert.IsNull(testObject);

            // test with changed COB-IDs
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(new CanOpenMessage((UInt16)(sendCobId + nodeId), 0x40, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00), this, out testObject, sendCobId, receiveCobId);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
        }
        #endregion is service data object download transfer request tests


        #region server side Unsigned8 tests
        /// <summary>
        /// Server side Unsigned8 expedited transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideUnsigned8ExpeditedTransferTest()
        {
            // initialization
            bool isServiceDataObjectUploadTransferRequest = false;
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned8 canOpenValueObject = new CanOpenUnsigned8(0x0008, 0x00, true, true);
            CanOpenUnsigned8 unknownCanOpenValueObject = new CanOpenUnsigned8(0x0000, 0x00, true, true);
            CanOpenUnsigned8 notReadableCanOpenValueObject = new CanOpenUnsigned8(0x1008, 0x00, true, true);
            ServiceDataObjectUploadTransfer testObject = null;
            ServiceDataObjectUploadTransfer clientTransfer = null;

            // test with value 100
            _canOpenUnsigned8.Value = 100;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenUnsigned8.Value, canOpenValueObject.Value);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with changed COB-IDs
            _canOpenUnsigned8.Value = 100;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenUnsigned8.Value, canOpenValueObject.Value);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with unkown object
            _canOpenUnsigned8.Value = 100;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with not readable object
            _canOpenUnsigned8.Value = 100;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(notReadableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010001", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Server side Unsigned8 block transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideUnsigned8BlockTransferTest()
        {
            // initialization
            bool isServiceDataObjectUploadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned8 canOpenValueObject = new CanOpenUnsigned8(0x0008, 0x00, true, true);
            CanOpenUnsigned8 unknownCanOpenValueObject = new CanOpenUnsigned8(0x0000, 0x00, true, true);
            CanOpenUnsigned8 notReadableCanOpenValueObject = new CanOpenUnsigned8(0x1008, 0x00, true, true);
            ServiceDataObjectUploadTransfer testObject = null;
            ServiceDataObjectUploadTransfer clientTransfer = null;

            // test with value 100
            _canOpenUnsigned8.Value = 100;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenUnsigned8.Value, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with changed COB-IDs
            _canOpenUnsigned8.Value = 100;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenUnsigned8.Value, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with unkown object
            _canOpenUnsigned8.Value = 100;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with not readable object
            _canOpenUnsigned8.Value = 100;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(notReadableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010001", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            //// test with protocol switching
            _canOpenUnsigned8.Value = 100;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 1);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenUnsigned8.Value, canOpenValueObject.Value);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK
        }
        #endregion server side Unsigned8 tests


        #region server side Integer8 tests
        /// <summary>
        /// Server side Integer8 expedited transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideInteger8ExpeditedTransferTest()
        {
            // initialization
            bool isServiceDataObjectUploadTransferRequest = false;
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger8 canOpenValueObject = new CanOpenInteger8(0x0008, 0x01, true, true);
            CanOpenInteger8 unknownCanOpenValueObject = new CanOpenInteger8(0x0000, 0x01, true, true);
            CanOpenInteger8 notReadableCanOpenValueObject = new CanOpenInteger8(0x1008, 0x01, true, true);
            ServiceDataObjectUploadTransfer testObject = null;
            ServiceDataObjectUploadTransfer clientTransfer = null;

            // test with value -100
            _canOpenInteger8.Value = -100;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenInteger8.Value, canOpenValueObject.Value);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with changed COB-IDs
            _canOpenInteger8.Value = -100;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenInteger8.Value, canOpenValueObject.Value);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with unkown object
            _canOpenInteger8.Value = -100;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with not readable object
            _canOpenInteger8.Value = -100;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(notReadableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010001", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Server side Integer8 block transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideInteger8BlockTransferTest()
        {
            // initialization
            bool isServiceDataObjectUploadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger8 canOpenValueObject = new CanOpenInteger8(0x0008, 0x01, true, true);
            CanOpenInteger8 unknownCanOpenValueObject = new CanOpenInteger8(0x0000, 0x01, true, true);
            CanOpenInteger8 notReadableCanOpenValueObject = new CanOpenInteger8(0x1008, 0x01, true, true);
            ServiceDataObjectUploadTransfer testObject = null;
            ServiceDataObjectUploadTransfer clientTransfer = null;

            // test with value -100
            _canOpenInteger8.Value = -100;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenInteger8.Value, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with changed COB-IDs
            _canOpenInteger8.Value = -100;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenInteger8.Value, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with unkown object
            _canOpenInteger8.Value = -100;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with not readable object
            _canOpenInteger8.Value = -100;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(notReadableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010001", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            //// test with protocol switching
            _canOpenInteger8.Value = -100;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 1);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenInteger8.Value, canOpenValueObject.Value);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK
        }
        #endregion server side Integer8 tests


        #region server side Unsigned16 tests
        /// <summary>
        /// Server side Unsigned16 expedited transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideUnsigned16ExpeditedTransferTest()
        {
            // initialization
            bool isServiceDataObjectUploadTransferRequest = false;
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned16 canOpenValueObject = new CanOpenUnsigned16(0x0016, 0x00, true, true);
            CanOpenUnsigned16 unknownCanOpenValueObject = new CanOpenUnsigned16(0x0000, 0x00, true, true);
            CanOpenUnsigned16 notReadableCanOpenValueObject = new CanOpenUnsigned16(0x1016, 0x00, true, true);
            ServiceDataObjectUploadTransfer testObject = null;
            ServiceDataObjectUploadTransfer clientTransfer = null;

            // test with value 10000
            _canOpenUnsigned16.Value = 10000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenUnsigned16.Value, canOpenValueObject.Value);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with changed COB-IDs
            _canOpenUnsigned16.Value = 10000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenUnsigned16.Value, canOpenValueObject.Value);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with unkown object
            _canOpenUnsigned16.Value = 10000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with not readable object
            _canOpenUnsigned16.Value = 10000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(notReadableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010001", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Server side Unsigned16 block transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideUnsigned16BlockTransferTest()
        {
            // initialization
            bool isServiceDataObjectUploadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned16 canOpenValueObject = new CanOpenUnsigned16(0x0016, 0x00, true, true);
            CanOpenUnsigned16 unknownCanOpenValueObject = new CanOpenUnsigned16(0x0000, 0x00, true, true);
            CanOpenUnsigned16 notReadableCanOpenValueObject = new CanOpenUnsigned16(0x1016, 0x00, true, true);
            ServiceDataObjectUploadTransfer testObject = null;
            ServiceDataObjectUploadTransfer clientTransfer = null;

            // test with value 10000
            _canOpenUnsigned16.Value = 10000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenUnsigned16.Value, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with changed COB-IDs
            _canOpenUnsigned16.Value = 10000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenUnsigned16.Value, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with unkown object
            _canOpenUnsigned16.Value = 10000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with not readable object
            _canOpenUnsigned16.Value = 10000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(notReadableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010001", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            //// test with protocol switching
            _canOpenUnsigned16.Value = 10000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 2);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenUnsigned16.Value, canOpenValueObject.Value);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK
        }
        #endregion server side Unsigned16 tests


        #region server side Integer16 tests
        /// <summary>
        /// Server side Integer16 expedited transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideInteger16ExpeditedTransferTest()
        {
            // initialization
            bool isServiceDataObjectUploadTransferRequest = false;
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger16 canOpenValueObject = new CanOpenInteger16(0x0016, 0x01, true, true);
            CanOpenInteger16 unknownCanOpenValueObject = new CanOpenInteger16(0x0000, 0x01, true, true);
            CanOpenInteger16 notReadableCanOpenValueObject = new CanOpenInteger16(0x1016, 0x01, true, true);
            ServiceDataObjectUploadTransfer testObject = null;
            ServiceDataObjectUploadTransfer clientTransfer = null;

            // test with value -10000
            _canOpenInteger16.Value = -10000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenInteger16.Value, canOpenValueObject.Value);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with changed COB-IDs
            _canOpenInteger16.Value = -10000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenInteger16.Value, canOpenValueObject.Value);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with unkown object
            _canOpenInteger16.Value = -10000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with not readable object
            _canOpenInteger16.Value = -10000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(notReadableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010001", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Server side Integer16 block transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideInteger16BlockTransferTest()
        {
            // initialization
            bool isServiceDataObjectUploadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger16 canOpenValueObject = new CanOpenInteger16(0x0016, 0x01, true, true);
            CanOpenInteger16 unknownCanOpenValueObject = new CanOpenInteger16(0x0000, 0x01, true, true);
            CanOpenInteger16 notReadableCanOpenValueObject = new CanOpenInteger16(0x1016, 0x01, true, true);
            ServiceDataObjectUploadTransfer testObject = null;
            ServiceDataObjectUploadTransfer clientTransfer = null;

            // test with value -10000
            _canOpenInteger16.Value = -10000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenInteger16.Value, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with changed COB-IDs
            _canOpenInteger16.Value = -10000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenInteger16.Value, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with unkown object
            _canOpenInteger16.Value = -10000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with not readable object
            _canOpenInteger16.Value = -10000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(notReadableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010001", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            //// test with protocol switching
            _canOpenInteger16.Value = -10000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 2);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenInteger16.Value, canOpenValueObject.Value);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK
        }
        #endregion server side Integer16 tests


        #region server side Unsigned24 tests
        /// <summary>
        /// Server side Unsigned24 expedited transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideUnsigned24ExpeditedTransferTest()
        {
            // initialization
            bool isServiceDataObjectUploadTransferRequest = false;
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned24 canOpenValueObject = new CanOpenUnsigned24(0x0024, 0x00, true, true);
            CanOpenUnsigned24 unknownCanOpenValueObject = new CanOpenUnsigned24(0x0000, 0x00, true, true);
            CanOpenUnsigned24 notReadableCanOpenValueObject = new CanOpenUnsigned24(0x1024, 0x00, true, true);
            ServiceDataObjectUploadTransfer testObject = null;
            ServiceDataObjectUploadTransfer clientTransfer = null;

            // test with value 1000000
            _canOpenUnsigned24.Value = 1000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenUnsigned24.Value, canOpenValueObject.Value);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with changed COB-IDs
            _canOpenUnsigned24.Value = 1000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenUnsigned24.Value, canOpenValueObject.Value);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with unkown object
            _canOpenUnsigned24.Value = 1000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with not readable object
            _canOpenUnsigned24.Value = 1000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(notReadableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010001", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Server side Unsigned24 block transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideUnsigned24BlockTransferTest()
        {
            // initialization
            bool isServiceDataObjectUploadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned24 canOpenValueObject = new CanOpenUnsigned24(0x0024, 0x00, true, true);
            CanOpenUnsigned24 unknownCanOpenValueObject = new CanOpenUnsigned24(0x0000, 0x00, true, true);
            CanOpenUnsigned24 notReadableCanOpenValueObject = new CanOpenUnsigned24(0x1024, 0x00, true, true);
            ServiceDataObjectUploadTransfer testObject = null;
            ServiceDataObjectUploadTransfer clientTransfer = null;

            // test with value 1000000
            _canOpenUnsigned24.Value = 1000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenUnsigned24.Value, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with changed COB-IDs
            _canOpenUnsigned24.Value = 1000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenUnsigned24.Value, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with unkown object
            _canOpenUnsigned24.Value = 1000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with not readable object
            _canOpenUnsigned24.Value = 1000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(notReadableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010001", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            //// test with protocol switching
            _canOpenUnsigned24.Value = 1000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 3);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenUnsigned24.Value, canOpenValueObject.Value);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK
        }
        #endregion server side Unsigned24 tests


        #region server side Integer24 tests
        /// <summary>
        /// Server side Integer24 expedited transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideInteger24ExpeditedTransferTest()
        {
            // initialization
            bool isServiceDataObjectUploadTransferRequest = false;
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger24 canOpenValueObject = new CanOpenInteger24(0x0024, 0x01, true, true);
            CanOpenInteger24 unknownCanOpenValueObject = new CanOpenInteger24(0x0000, 0x01, true, true);
            CanOpenInteger24 notReadableCanOpenValueObject = new CanOpenInteger24(0x1024, 0x01, true, true);
            ServiceDataObjectUploadTransfer testObject = null;
            ServiceDataObjectUploadTransfer clientTransfer = null;

            // test with value -1000000
            _canOpenInteger24.Value = -1000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenInteger24.Value, canOpenValueObject.Value);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with changed COB-IDs
            _canOpenInteger24.Value = -1000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenInteger24.Value, canOpenValueObject.Value);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with unkown object
            _canOpenInteger24.Value = -1000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with not readable object
            _canOpenInteger24.Value = -1000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(notReadableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010001", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Server side Integer24 block transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideInteger24BlockTransferTest()
        {
            // initialization
            bool isServiceDataObjectUploadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger24 canOpenValueObject = new CanOpenInteger24(0x0024, 0x01, true, true);
            CanOpenInteger24 unknownCanOpenValueObject = new CanOpenInteger24(0x0000, 0x01, true, true);
            CanOpenInteger24 notReadableCanOpenValueObject = new CanOpenInteger24(0x1024, 0x01, true, true);
            ServiceDataObjectUploadTransfer testObject = null;
            ServiceDataObjectUploadTransfer clientTransfer = null;

            // test with value -1000000
            _canOpenInteger24.Value = -1000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenInteger24.Value, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with changed COB-IDs
            _canOpenInteger24.Value = -1000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenInteger24.Value, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with unkown object
            _canOpenInteger24.Value = -1000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with not readable object
            _canOpenInteger24.Value = -1000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(notReadableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010001", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            //// test with protocol switching
            _canOpenInteger24.Value = -1000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 3);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenInteger24.Value, canOpenValueObject.Value);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK
        }
        #endregion server side Integer24 tests


        #region server side Unsigned32 tests
        /// <summary>
        /// Server side Unsigned32 expedited transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideUnsigned32ExpeditedTransferTest()
        {
            // initialization
            bool isServiceDataObjectUploadTransferRequest = false;
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned32 canOpenValueObject = new CanOpenUnsigned32(0x0032, 0x00, true, true);
            CanOpenUnsigned32 unknownCanOpenValueObject = new CanOpenUnsigned32(0x0000, 0x00, true, true);
            CanOpenUnsigned32 notReadableCanOpenValueObject = new CanOpenUnsigned32(0x1032, 0x00, true, true);
            ServiceDataObjectUploadTransfer testObject = null;
            ServiceDataObjectUploadTransfer clientTransfer = null;

            // test with value 1000000000
            _canOpenUnsigned32.Value = 1000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenUnsigned32.Value, canOpenValueObject.Value);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with changed COB-IDs
            _canOpenUnsigned32.Value = 1000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenUnsigned32.Value, canOpenValueObject.Value);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with unkown object
            _canOpenUnsigned32.Value = 1000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with not readable object
            _canOpenUnsigned32.Value = 1000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(notReadableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010001", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Server side Unsigned32 block transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideUnsigned32BlockTransferTest()
        {
            // initialization
            bool isServiceDataObjectUploadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned32 canOpenValueObject = new CanOpenUnsigned32(0x0032, 0x00, true, true);
            CanOpenUnsigned32 unknownCanOpenValueObject = new CanOpenUnsigned32(0x0000, 0x00, true, true);
            CanOpenUnsigned32 notReadableCanOpenValueObject = new CanOpenUnsigned32(0x1032, 0x00, true, true);
            ServiceDataObjectUploadTransfer testObject = null;
            ServiceDataObjectUploadTransfer clientTransfer = null;

            // test with value 1000000000
            _canOpenUnsigned32.Value = 1000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenUnsigned32.Value, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with changed COB-IDs
            _canOpenUnsigned32.Value = 1000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenUnsigned32.Value, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with unkown object
            _canOpenUnsigned32.Value = 1000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with not readable object
            _canOpenUnsigned32.Value = 1000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(notReadableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010001", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            //// test with protocol switching
            _canOpenUnsigned32.Value = 1000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 4);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenUnsigned32.Value, canOpenValueObject.Value);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK
        }
        #endregion server side Unsigned32 tests


        #region server side Integer32 tests
        /// <summary>
        /// Server side Integer32 expedited transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideInteger32ExpeditedTransferTest()
        {
            // initialization
            bool isServiceDataObjectUploadTransferRequest = false;
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger32 canOpenValueObject = new CanOpenInteger32(0x0032, 0x01, true, true);
            CanOpenInteger32 unknownCanOpenValueObject = new CanOpenInteger32(0x0000, 0x01, true, true);
            CanOpenInteger32 notReadableCanOpenValueObject = new CanOpenInteger32(0x1032, 0x01, true, true);
            ServiceDataObjectUploadTransfer testObject = null;
            ServiceDataObjectUploadTransfer clientTransfer = null;

            // test with value -1000000000
            _canOpenInteger32.Value = -1000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenInteger32.Value, canOpenValueObject.Value);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with changed COB-IDs
            _canOpenInteger32.Value = -1000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenInteger32.Value, canOpenValueObject.Value);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with unkown object
            _canOpenInteger32.Value = -1000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with not readable object
            _canOpenInteger32.Value = -1000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(notReadableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010001", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Server side Integer32 block transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideInteger32BlockTransferTest()
        {
            // initialization
            bool isServiceDataObjectUploadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger32 canOpenValueObject = new CanOpenInteger32(0x0032, 0x01, true, true);
            CanOpenInteger32 unknownCanOpenValueObject = new CanOpenInteger32(0x0000, 0x01, true, true);
            CanOpenInteger32 notReadableCanOpenValueObject = new CanOpenInteger32(0x1032, 0x01, true, true);
            ServiceDataObjectUploadTransfer testObject = null;
            ServiceDataObjectUploadTransfer clientTransfer = null;

            // test with value -1000000000
            _canOpenInteger32.Value = -1000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenInteger32.Value, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with changed COB-IDs
            _canOpenInteger32.Value = -1000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenInteger32.Value, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with unkown object
            _canOpenInteger32.Value = -1000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with not readable object
            _canOpenInteger32.Value = -1000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(notReadableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010001", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            //// test with protocol switching
            _canOpenInteger32.Value = -1000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 4);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenInteger32.Value, canOpenValueObject.Value);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK
        }
        #endregion server side Integer32 tests


        #region server side Unsigned40 tests
        /// <summary>
        /// Server side Unsigned40 expedited transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideUnsigned40ExpeditedTransferTest()
        {
            // initialization
            bool isServiceDataObjectUploadTransferRequest = false;
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned40 canOpenValueObject = new CanOpenUnsigned40(0x0040, 0x00, true, true);
            CanOpenUnsigned40 unknownCanOpenValueObject = new CanOpenUnsigned40(0x0000, 0x00, true, true);
            CanOpenUnsigned40 notReadableCanOpenValueObject = new CanOpenUnsigned40(0x1040, 0x00, true, true);
            ServiceDataObjectUploadTransfer testObject = null;
            ServiceDataObjectUploadTransfer clientTransfer = null;

            // test with value 100000000000
            _canOpenUnsigned40.Value = 100000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenUnsigned40.Value, canOpenValueObject.Value);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with changed COB-IDs
            _canOpenUnsigned40.Value = 100000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenUnsigned40.Value, canOpenValueObject.Value);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with unkown object
            _canOpenUnsigned40.Value = 100000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with not readable object
            _canOpenUnsigned40.Value = 100000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(notReadableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010001", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Server side Unsigned40 block transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideUnsigned40BlockTransferTest()
        {
            // initialization
            bool isServiceDataObjectUploadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned40 canOpenValueObject = new CanOpenUnsigned40(0x0040, 0x00, true, true);
            CanOpenUnsigned40 unknownCanOpenValueObject = new CanOpenUnsigned40(0x0000, 0x00, true, true);
            CanOpenUnsigned40 notReadableCanOpenValueObject = new CanOpenUnsigned40(0x1040, 0x00, true, true);
            ServiceDataObjectUploadTransfer testObject = null;
            ServiceDataObjectUploadTransfer clientTransfer = null;

            // test with value 100000000000
            _canOpenUnsigned40.Value = 100000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenUnsigned40.Value, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with changed COB-IDs
            _canOpenUnsigned40.Value = 100000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenUnsigned40.Value, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with unkown object
            _canOpenUnsigned40.Value = 100000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with not readable object
            _canOpenUnsigned40.Value = 100000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(notReadableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010001", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            //// test with protocol switching
            _canOpenUnsigned40.Value = 100000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 5);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenUnsigned40.Value, canOpenValueObject.Value);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK
        }
        #endregion server side Unsigned40 tests


        #region server side Integer40 tests
        /// <summary>
        /// Server side Integer40 expedited transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideInteger40ExpeditedTransferTest()
        {
            // initialization
            bool isServiceDataObjectUploadTransferRequest = false;
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger40 canOpenValueObject = new CanOpenInteger40(0x0040, 0x01, true, true);
            CanOpenInteger40 unknownCanOpenValueObject = new CanOpenInteger40(0x0000, 0x01, true, true);
            CanOpenInteger40 notReadableCanOpenValueObject = new CanOpenInteger40(0x1040, 0x01, true, true);
            ServiceDataObjectUploadTransfer testObject = null;
            ServiceDataObjectUploadTransfer clientTransfer = null;

            // test with value -100000000000
            _canOpenInteger40.Value = -100000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenInteger40.Value, canOpenValueObject.Value);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with changed COB-IDs
            _canOpenInteger40.Value = -100000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenInteger40.Value, canOpenValueObject.Value);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with unkown object
            _canOpenInteger40.Value = -100000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with not readable object
            _canOpenInteger40.Value = -100000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(notReadableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010001", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Server side Integer40 block transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideInteger40BlockTransferTest()
        {
            // initialization
            bool isServiceDataObjectUploadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger40 canOpenValueObject = new CanOpenInteger40(0x0040, 0x01, true, true);
            CanOpenInteger40 unknownCanOpenValueObject = new CanOpenInteger40(0x0000, 0x01, true, true);
            CanOpenInteger40 notReadableCanOpenValueObject = new CanOpenInteger40(0x1040, 0x01, true, true);
            ServiceDataObjectUploadTransfer testObject = null;
            ServiceDataObjectUploadTransfer clientTransfer = null;

            // test with value -100000000000
            _canOpenInteger40.Value = -100000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenInteger40.Value, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with changed COB-IDs
            _canOpenInteger40.Value = -100000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenInteger40.Value, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with unkown object
            _canOpenInteger40.Value = -100000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with not readable object
            _canOpenInteger40.Value = -100000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(notReadableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010001", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            //// test with protocol switching
            _canOpenInteger40.Value = -100000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 5);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenInteger40.Value, canOpenValueObject.Value);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK
        }
        #endregion server side Integer40 tests


        #region server side Unsigned48 tests
        /// <summary>
        /// Server side Unsigned48 expedited transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideUnsigned48ExpeditedTransferTest()
        {
            // initialization
            bool isServiceDataObjectUploadTransferRequest = false;
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned48 canOpenValueObject = new CanOpenUnsigned48(0x0048, 0x00, true, true);
            CanOpenUnsigned48 unknownCanOpenValueObject = new CanOpenUnsigned48(0x0000, 0x00, true, true);
            CanOpenUnsigned48 notReadableCanOpenValueObject = new CanOpenUnsigned48(0x1048, 0x00, true, true);
            ServiceDataObjectUploadTransfer testObject = null;
            ServiceDataObjectUploadTransfer clientTransfer = null;

            // test with value 100000000000000
            _canOpenUnsigned48.Value = 100000000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenUnsigned48.Value, canOpenValueObject.Value);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with changed COB-IDs
            _canOpenUnsigned48.Value = 100000000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenUnsigned48.Value, canOpenValueObject.Value);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with unkown object
            _canOpenUnsigned48.Value = 100000000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with not readable object
            _canOpenUnsigned48.Value = 100000000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(notReadableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010001", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Server side Unsigned48 block transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideUnsigned48BlockTransferTest()
        {
            // initialization
            bool isServiceDataObjectUploadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned48 canOpenValueObject = new CanOpenUnsigned48(0x0048, 0x00, true, true);
            CanOpenUnsigned48 unknownCanOpenValueObject = new CanOpenUnsigned48(0x0000, 0x00, true, true);
            CanOpenUnsigned48 notReadableCanOpenValueObject = new CanOpenUnsigned48(0x1048, 0x00, true, true);
            ServiceDataObjectUploadTransfer testObject = null;
            ServiceDataObjectUploadTransfer clientTransfer = null;

            // test with value 100000000000000
            _canOpenUnsigned48.Value = 100000000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenUnsigned48.Value, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with changed COB-IDs
            _canOpenUnsigned48.Value = 100000000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenUnsigned48.Value, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with unkown object
            _canOpenUnsigned48.Value = 100000000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with not readable object
            _canOpenUnsigned48.Value = 100000000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(notReadableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010001", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            //// test with protocol switching
            _canOpenUnsigned48.Value = 100000000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 6);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenUnsigned48.Value, canOpenValueObject.Value);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK
        }
        #endregion server side Unsigned48 tests


        #region server side Integer48 tests
        /// <summary>
        /// Server side Integer48 expedited transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideInteger48ExpeditedTransferTest()
        {
            // initialization
            bool isServiceDataObjectUploadTransferRequest = false;
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger48 canOpenValueObject = new CanOpenInteger48(0x0048, 0x01, true, true);
            CanOpenInteger48 unknownCanOpenValueObject = new CanOpenInteger48(0x0000, 0x01, true, true);
            CanOpenInteger48 notReadableCanOpenValueObject = new CanOpenInteger48(0x1048, 0x01, true, true);
            ServiceDataObjectUploadTransfer testObject = null;
            ServiceDataObjectUploadTransfer clientTransfer = null;

            // test with value -100000000000000
            _canOpenInteger48.Value = -100000000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenInteger48.Value, canOpenValueObject.Value);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with changed COB-IDs
            _canOpenInteger48.Value = -100000000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenInteger48.Value, canOpenValueObject.Value);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with unkown object
            _canOpenInteger48.Value = -100000000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with not readable object
            _canOpenInteger48.Value = -100000000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(notReadableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010001", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Server side Integer48 block transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideInteger48BlockTransferTest()
        {
            // initialization
            bool isServiceDataObjectUploadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger48 canOpenValueObject = new CanOpenInteger48(0x0048, 0x01, true, true);
            CanOpenInteger48 unknownCanOpenValueObject = new CanOpenInteger48(0x0000, 0x01, true, true);
            CanOpenInteger48 notReadableCanOpenValueObject = new CanOpenInteger48(0x1048, 0x01, true, true);
            ServiceDataObjectUploadTransfer testObject = null;
            ServiceDataObjectUploadTransfer clientTransfer = null;

            // test with value -100000000000000
            _canOpenInteger48.Value = -100000000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenInteger48.Value, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with changed COB-IDs
            _canOpenInteger48.Value = -100000000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenInteger48.Value, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with unkown object
            _canOpenInteger48.Value = -100000000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with not readable object
            _canOpenInteger48.Value = -100000000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(notReadableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010001", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            //// test with protocol switching
            _canOpenInteger48.Value = -100000000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 6);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenInteger48.Value, canOpenValueObject.Value);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK
        }
        #endregion server side Integer48 tests


        #region server side Unsigned56 tests
        /// <summary>
        /// Server side Unsigned56 expedited transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideUnsigned56ExpeditedTransferTest()
        {
            // initialization
            bool isServiceDataObjectUploadTransferRequest = false;
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned56 canOpenValueObject = new CanOpenUnsigned56(0x0056, 0x00, true, true);
            CanOpenUnsigned56 unknownCanOpenValueObject = new CanOpenUnsigned56(0x0000, 0x00, true, true);
            CanOpenUnsigned56 notReadableCanOpenValueObject = new CanOpenUnsigned56(0x1056, 0x00, true, true);
            ServiceDataObjectUploadTransfer testObject = null;
            ServiceDataObjectUploadTransfer clientTransfer = null;

            // test with value 10000000000000000
            _canOpenUnsigned56.Value = 10000000000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenUnsigned56.Value, canOpenValueObject.Value);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with changed COB-IDs
            _canOpenUnsigned56.Value = 10000000000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenUnsigned56.Value, canOpenValueObject.Value);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with unkown object
            _canOpenUnsigned56.Value = 10000000000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with not readable object
            _canOpenUnsigned56.Value = 10000000000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(notReadableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010001", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Server side Unsigned56 block transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideUnsigned56BlockTransferTest()
        {
            // initialization
            bool isServiceDataObjectUploadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned56 canOpenValueObject = new CanOpenUnsigned56(0x0056, 0x00, true, true);
            CanOpenUnsigned56 unknownCanOpenValueObject = new CanOpenUnsigned56(0x0000, 0x00, true, true);
            CanOpenUnsigned56 notReadableCanOpenValueObject = new CanOpenUnsigned56(0x1056, 0x00, true, true);
            ServiceDataObjectUploadTransfer testObject = null;
            ServiceDataObjectUploadTransfer clientTransfer = null;

            // test with value 10000000000000000
            _canOpenUnsigned56.Value = 10000000000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenUnsigned56.Value, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with changed COB-IDs
            _canOpenUnsigned56.Value = 10000000000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenUnsigned56.Value, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with unkown object
            _canOpenUnsigned56.Value = 10000000000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with not readable object
            _canOpenUnsigned56.Value = 10000000000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(notReadableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010001", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            //// test with protocol switching
            _canOpenUnsigned56.Value = 10000000000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 7);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenUnsigned56.Value, canOpenValueObject.Value);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK
        }
        #endregion server side Unsigned56 tests


        #region server side Integer56 tests
        /// <summary>
        /// Server side Integer56 expedited transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideInteger56ExpeditedTransferTest()
        {
            // initialization
            bool isServiceDataObjectUploadTransferRequest = false;
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger56 canOpenValueObject = new CanOpenInteger56(0x0056, 0x01, true, true);
            CanOpenInteger56 unknownCanOpenValueObject = new CanOpenInteger56(0x0000, 0x01, true, true);
            CanOpenInteger56 notReadableCanOpenValueObject = new CanOpenInteger56(0x1056, 0x01, true, true);
            ServiceDataObjectUploadTransfer testObject = null;
            ServiceDataObjectUploadTransfer clientTransfer = null;

            // test with value -10000000000000000
            _canOpenInteger56.Value = -10000000000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenInteger56.Value, canOpenValueObject.Value);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with changed COB-IDs
            _canOpenInteger56.Value = -10000000000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenInteger56.Value, canOpenValueObject.Value);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with unkown object
            _canOpenInteger56.Value = -10000000000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with not readable object
            _canOpenInteger56.Value = -10000000000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(notReadableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010001", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Server side Integer56 block transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideInteger56BlockTransferTest()
        {
            // initialization
            bool isServiceDataObjectUploadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger56 canOpenValueObject = new CanOpenInteger56(0x0056, 0x01, true, true);
            CanOpenInteger56 unknownCanOpenValueObject = new CanOpenInteger56(0x0000, 0x01, true, true);
            CanOpenInteger56 notReadableCanOpenValueObject = new CanOpenInteger56(0x1056, 0x01, true, true);
            ServiceDataObjectUploadTransfer testObject = null;
            ServiceDataObjectUploadTransfer clientTransfer = null;

            // test with value -10000000000000000
            _canOpenInteger56.Value = -10000000000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenInteger56.Value, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with changed COB-IDs
            _canOpenInteger56.Value = -10000000000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenInteger56.Value, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with unkown object
            _canOpenInteger56.Value = -10000000000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with not readable object
            _canOpenInteger56.Value = -10000000000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(notReadableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010001", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            //// test with protocol switching
            _canOpenInteger56.Value = -10000000000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 7);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenInteger56.Value, canOpenValueObject.Value);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK
        }
        #endregion server side Integer56 tests


        #region server side Unsigned64 tests
        /// <summary>
        /// Server side Unsigned64 expedited transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideUnsigned64ExpeditedTransferTest()
        {
            // initialization
            bool isServiceDataObjectUploadTransferRequest = false;
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned64 canOpenValueObject = new CanOpenUnsigned64(0x0064, 0x00, true, true);
            CanOpenUnsigned64 unknownCanOpenValueObject = new CanOpenUnsigned64(0x0000, 0x00, true, true);
            CanOpenUnsigned64 notReadableCanOpenValueObject = new CanOpenUnsigned64(0x1064, 0x00, true, true);
            ServiceDataObjectUploadTransfer testObject = null;
            ServiceDataObjectUploadTransfer clientTransfer = null;

            // test with value 1000000000000000000
            _canOpenUnsigned64.Value = 1000000000000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenUnsigned64.Value, canOpenValueObject.Value);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with changed COB-IDs
            _canOpenUnsigned64.Value = 1000000000000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenUnsigned64.Value, canOpenValueObject.Value);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with unkown object
            _canOpenUnsigned64.Value = 1000000000000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with not readable object
            _canOpenUnsigned64.Value = 1000000000000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(notReadableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010001", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Server side Unsigned64 block transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideUnsigned64BlockTransferTest()
        {
            // initialization
            bool isServiceDataObjectUploadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenUnsigned64 canOpenValueObject = new CanOpenUnsigned64(0x0064, 0x00, true, true);
            CanOpenUnsigned64 unknownCanOpenValueObject = new CanOpenUnsigned64(0x0000, 0x00, true, true);
            CanOpenUnsigned64 notReadableCanOpenValueObject = new CanOpenUnsigned64(0x1064, 0x00, true, true);
            ServiceDataObjectUploadTransfer testObject = null;
            ServiceDataObjectUploadTransfer clientTransfer = null;

            // test with value 1000000000000000000
            _canOpenUnsigned64.Value = 1000000000000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[1]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenUnsigned64.Value, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with changed COB-IDs
            _canOpenUnsigned64.Value = 1000000000000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[1]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenUnsigned64.Value, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with unkown object
            _canOpenUnsigned64.Value = 1000000000000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with not readable object
            _canOpenUnsigned64.Value = 1000000000000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(notReadableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((ulong)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010001", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            //// test with protocol switching
            _canOpenUnsigned64.Value = 1000000000000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 8);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenUnsigned64.Value, canOpenValueObject.Value);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK
        }
        #endregion server side Unsigned64 tests


        #region server side Integer64 tests
        /// <summary>
        /// Server side Integer64 expedited transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideInteger64ExpeditedTransferTest()
        {
            // initialization
            bool isServiceDataObjectUploadTransferRequest = false;
            byte nodeId = 103;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger64 canOpenValueObject = new CanOpenInteger64(0x0064, 0x01, true, true);
            CanOpenInteger64 unknownCanOpenValueObject = new CanOpenInteger64(0x0000, 0x01, true, true);
            CanOpenInteger64 notReadableCanOpenValueObject = new CanOpenInteger64(0x1064, 0x01, true, true);
            ServiceDataObjectUploadTransfer testObject = null;
            ServiceDataObjectUploadTransfer clientTransfer = null;

            // test with value -1000000000000000000
            _canOpenInteger64.Value = -1000000000000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenInteger64.Value, canOpenValueObject.Value);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with changed COB-IDs
            _canOpenInteger64.Value = -1000000000000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer, sendCobId, receiveCobId);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenInteger64.Value, canOpenValueObject.Value);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with unkown object
            _canOpenInteger64.Value = -1000000000000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with not readable object
            _canOpenInteger64.Value = -1000000000000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(notReadableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.SegmentedTransfer);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010001", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
        }

        /// <summary>
        /// Server side Integer64 block transfer test
        /// </summary>
        [TestMethod]
        public void ServerSideInteger64BlockTransferTest()
        {
            // initialization
            bool isServiceDataObjectUploadTransferRequest = false;
            byte nodeId = 103;
            byte blockSize = 127;
            UInt16 sendCobId = 0x601;
            UInt16 receiveCobId = 0x575;
            CanOpenInteger64 canOpenValueObject = new CanOpenInteger64(0x0064, 0x01, true, true);
            CanOpenInteger64 unknownCanOpenValueObject = new CanOpenInteger64(0x0000, 0x01, true, true);
            CanOpenInteger64 notReadableCanOpenValueObject = new CanOpenInteger64(0x1064, 0x01, true, true);
            ServiceDataObjectUploadTransfer testObject = null;
            ServiceDataObjectUploadTransfer clientTransfer = null;

            // test with value -1000000000000000000
            _canOpenInteger64.Value = -1000000000000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[1]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenInteger64.Value, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with changed COB-IDs
            _canOpenInteger64.Value = -1000000000000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, sendCobId, receiveCobId, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject, sendCobId, receiveCobId);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[1]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenInteger64.Value, canOpenValueObject.Value);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(0, testObject.PendingSendMessages.Count);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK

            // test with unkown object
            _canOpenInteger64.Value = -1000000000000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(unknownCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06020000", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            // test with not readable object
            _canOpenInteger64.Value = -1000000000000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(notReadableCanOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 0);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.AreEqual((long)0, canOpenValueObject.Value);
            Assert.IsNotNull(testObject.AbortCode);
            Assert.AreEqual("0x06010001", testObject.AbortCode.HexString);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);

            //// test with protocol switching
            _canOpenInteger64.Value = -1000000000000000000;
            canOpenValueObject.Value = 0;
            clientTransfer = new ServiceDataObjectUploadTransfer(canOpenValueObject, nodeId, ServiceDataObjectTransferMode.BlockTransfer, blockSize, 8);
            clientTransfer.Start();
            isServiceDataObjectUploadTransferRequest = ServiceDataObjectUploadTransfer.IsServiceDataObjectUploadTransferRequest(clientTransfer.PendingSendMessages[0], this, out testObject);
            Assert.AreEqual(true, isServiceDataObjectUploadTransferRequest);
            Assert.IsNotNull(testObject);
            testObject.Start();
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.IsNull(testObject.AbortCode);
            Assert.AreEqual(false, testObject.TransferComplete);
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            testObject.ProcessReceivedMessage(clientTransfer.PendingSendMessages[0]);
            Assert.IsNull(testObject.AbortCode);
            //Assert.AreEqual(true, testObject.TransferComplete); HACK
            Assert.IsNotNull(testObject.PendingSendMessages);
            Assert.AreEqual(1, testObject.PendingSendMessages.Count);
            clientTransfer.ProcessReceivedMessage(testObject.PendingSendMessages[0]);
            Assert.AreEqual(_canOpenInteger64.Value, canOpenValueObject.Value);
            Assert.IsNull(clientTransfer.AbortCode);
            //Assert.AreEqual(true, clientTransfer.TransferComplete); HACK
        }
        #endregion server side Integer64 tests


        #region ICanOpenObjectDictionaryContainer
        /// <summary>for internal use</summary>
        private CanOpenUnsigned8 _canOpenUnsigned8 = new CanOpenUnsigned8(0x0008, 0x00, true, true);
        /// <summary>for internal use</summary>
        private CanOpenInteger8 _canOpenInteger8 = new CanOpenInteger8(0x0008, 0x01, true, true);
        /// <summary>for internal use</summary>
        private CanOpenUnsigned16 _canOpenUnsigned16 = new CanOpenUnsigned16(0x0016, 0x00, true, true);
        /// <summary>for internal use</summary>
        private CanOpenInteger16 _canOpenInteger16 = new CanOpenInteger16(0x0016, 0x01, true, true);
        /// <summary>for internal use</summary>
        private CanOpenUnsigned24 _canOpenUnsigned24 = new CanOpenUnsigned24(0x0024, 0x00, true, true);
        /// <summary>for internal use</summary>
        private CanOpenInteger24 _canOpenInteger24 = new CanOpenInteger24(0x0024, 0x01, true, true);
        /// <summary>for internal use</summary>
        private CanOpenUnsigned32 _canOpenUnsigned32 = new CanOpenUnsigned32(0x0032, 0x00, true, true);
        /// <summary>for internal use</summary>
        private CanOpenInteger32 _canOpenInteger32 = new CanOpenInteger32(0x0032, 0x01, true, true);
        /// <summary>for internal use</summary>
        private CanOpenUnsigned40 _canOpenUnsigned40 = new CanOpenUnsigned40(0x0040, 0x00, true, true);
        /// <summary>for internal use</summary>
        private CanOpenInteger40 _canOpenInteger40 = new CanOpenInteger40(0x0040, 0x01, true, true);
        /// <summary>for internal use</summary>
        private CanOpenUnsigned48 _canOpenUnsigned48 = new CanOpenUnsigned48(0x0048, 0x00, true, true);
        /// <summary>for internal use</summary>
        private CanOpenInteger48 _canOpenInteger48 = new CanOpenInteger48(0x0048, 0x01, true, true);
        /// <summary>for internal use</summary>
        private CanOpenUnsigned56 _canOpenUnsigned56 = new CanOpenUnsigned56(0x0056, 0x00, true, true);
        /// <summary>for internal use</summary>
        private CanOpenInteger56 _canOpenInteger56 = new CanOpenInteger56(0x0056, 0x01, true, true);
        /// <summary>for internal use</summary>
        private CanOpenUnsigned64 _canOpenUnsigned64 = new CanOpenUnsigned64(0x0064, 0x00, true, true);
        /// <summary>for internal use</summary>
        private CanOpenInteger64 _canOpenInteger64 = new CanOpenInteger64(0x0064, 0x01, true, true);
        /// <summary>for internal use</summary>
        private CanOpenUnsigned8 _notReadableCanOpenUnsigned8 = new CanOpenUnsigned8(0x1008, 0x00, false, true);
        /// <summary>for internal use</summary>
        private CanOpenInteger8 _notReadableCanOpenInteger8 = new CanOpenInteger8(0x1008, 0x01, false, true);
        /// <summary>for internal use</summary>
        private CanOpenUnsigned16 _notReadableCanOpenUnsigned16 = new CanOpenUnsigned16(0x1016, 0x00, false, true);
        /// <summary>for internal use</summary>
        private CanOpenInteger16 _notReadableCanOpenInteger16 = new CanOpenInteger16(0x1016, 0x01, false, true);
        /// <summary>for internal use</summary>
        private CanOpenUnsigned24 _notReadableCanOpenUnsigned24 = new CanOpenUnsigned24(0x1024, 0x00, false, true);
        /// <summary>for internal use</summary>
        private CanOpenInteger24 _notReadableCanOpenInteger24 = new CanOpenInteger24(0x1024, 0x01, false, true);
        /// <summary>for internal use</summary>
        private CanOpenUnsigned32 _notReadableCanOpenUnsigned32 = new CanOpenUnsigned32(0x1032, 0x00, false, true);
        /// <summary>for internal use</summary>
        private CanOpenInteger32 _notReadableCanOpenInteger32 = new CanOpenInteger32(0x1032, 0x01, false, true);
        /// <summary>for internal use</summary>
        private CanOpenUnsigned40 _notReadableCanOpenUnsigned40 = new CanOpenUnsigned40(0x1040, 0x00, false, true);
        /// <summary>for internal use</summary>
        private CanOpenInteger40 _notReadableCanOpenInteger40 = new CanOpenInteger40(0x1040, 0x01, false, true);
        /// <summary>for internal use</summary>
        private CanOpenUnsigned48 _notReadableCanOpenUnsigned48 = new CanOpenUnsigned48(0x1048, 0x00, false, true);
        /// <summary>for internal use</summary>
        private CanOpenInteger48 _notReadableCanOpenInteger48 = new CanOpenInteger48(0x1048, 0x01, false, true);
        /// <summary>for internal use</summary>
        private CanOpenUnsigned56 _notReadableCanOpenUnsigned56 = new CanOpenUnsigned56(0x1056, 0x00, false, true);
        /// <summary>for internal use</summary>
        private CanOpenInteger56 _notReadableCanOpenInteger56 = new CanOpenInteger56(0x1056, 0x01, false, true);
        /// <summary>for internal use</summary>
        private CanOpenUnsigned64 _notReadableCanOpenUnsigned64 = new CanOpenUnsigned64(0x1064, 0x00, false, true);
        /// <summary>for internal use</summary>
        private CanOpenInteger64 _notReadableCanOpenInteger64 = new CanOpenInteger64(0x1064, 0x01, false, true);

        /// <summary>
        /// Gets the node id of the can open object dictionary container
        /// </summary>
        byte ICanOpenObjectDictionaryContainer.NodeId
        {
            get
            {
                return 103;
            }
        }

        /// <summary>
        /// Gets the can open object with the given index as can open data field
        /// object
        /// </summary>
        /// <param name="index">
        /// Index of the can open object to get
        /// </param>
        /// <returns>
        /// The can open object with the given index as data field object or
        /// null
        /// </returns>
        ICanOpenDataFieldObject ICanOpenObjectDictionaryContainer.GetCanOpenObject(UInt16 index)
        {
            return null;
        }

        /// <summary>
        /// Gets the can open object with the given index and sub index as can
        /// open value object
        /// </summary>
        /// <param name="index">
        /// Index of the can open object to get
        /// </param>
        /// <param name="subIndex">
        /// Sub index of the can open object to get
        /// </param>
        /// <returns>
        /// The can open object with the given index and sub index as value
        /// object or null
        /// </returns>
        ICanOpenValueObject ICanOpenObjectDictionaryContainer.GetCanOpenObject(UInt16 index, byte subIndex)
        {
            if (subIndex == 0x00)
            {
                switch (index)
                {
                    case 0x0008:
                        return _canOpenUnsigned8;
                    case 0x1008:
                        return _notReadableCanOpenUnsigned8;
                    case 0x0016:
                        return _canOpenUnsigned16;
                    case 0x1016:
                        return _notReadableCanOpenUnsigned16;
                    case 0x0024:
                        return _canOpenUnsigned24;
                    case 0x1024:
                        return _notReadableCanOpenUnsigned24;
                    case 0x0032:
                        return _canOpenUnsigned32;
                    case 0x1032:
                        return _notReadableCanOpenUnsigned32;
                    case 0x0040:
                        return _canOpenUnsigned40;
                    case 0x1040:
                        return _notReadableCanOpenUnsigned40;
                    case 0x0048:
                        return _canOpenUnsigned48;
                    case 0x1048:
                        return _notReadableCanOpenUnsigned48;
                    case 0x0056:
                        return _canOpenUnsigned56;
                    case 0x1056:
                        return _notReadableCanOpenUnsigned56;
                    case 0x0064:
                        return _canOpenUnsigned64;
                    case 0x1064:
                        return _notReadableCanOpenUnsigned64;
                }
            }
            else if (subIndex == 0x01)
            {
                switch (index)
                {
                    case 0x0008:
                        return _canOpenInteger8;
                    case 0x1008:
                        return _notReadableCanOpenInteger8;
                    case 0x0016:
                        return _canOpenInteger16;
                    case 0x1016:
                        return _notReadableCanOpenInteger16;
                    case 0x0024:
                        return _canOpenInteger24;
                    case 0x1024:
                        return _notReadableCanOpenInteger24;
                    case 0x0032:
                        return _canOpenInteger32;
                    case 0x1032:
                        return _notReadableCanOpenInteger32;
                    case 0x0040:
                        return _canOpenInteger40;
                    case 0x1040:
                        return _notReadableCanOpenInteger40;
                    case 0x0048:
                        return _canOpenInteger48;
                    case 0x1048:
                        return _notReadableCanOpenInteger48;
                    case 0x0056:
                        return _canOpenInteger56;
                    case 0x1056:
                        return _notReadableCanOpenInteger56;
                    case 0x0064:
                        return _canOpenInteger64;
                    case 0x1064:
                        return _notReadableCanOpenInteger64;
                }
            }
            return null;
        }
        #endregion ICanOpenObjectDictionaryContainer

    }

}
